package chapter07

/**
 *
 * @author cdhuangchao3
 * @date 2023/6/10 3:28 PM
 */
object Test06_ImmutableSet {
  def main(args: Array[String]): Unit = {
    // 1.创建set
    val set1 = Set(1,2,3,2)
    println(set1)

    // 2.添加元素
    var set2 = set1.+(20)
    println(set2)
    set2 = set1 + 19
    println(set2)

    println("="*20)
    // 3.合并set
    val set3 = Set(1,3,4,5,7,9)
    val set4 = set2 ++ set3
    println(set2)
    println(set4)

    // 4.删除元素
    val set5 = set4 - 5
    println(set5)
  }
}
